{
 "cells": [
  {
   "cell_type": "markdown",
   "source": [
    "Chapter 07\n",
    "# 用if判断是否成绩及格，三层判断\n",
    "Book_1《编程不难》 | 鸢尾花书：从加减乘除到机器学习"
   ],
   "metadata": {
    "collapsed": false
   }
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "及格\n"
     ]
    }
   ],
   "source": [
    "value = input(\"请输入一个数值: \")\n",
    "\n",
    "# 第一层\n",
    "if value.isdigit():\n",
    "    number = int(value)\n",
    "\n",
    "    # 第二层\n",
    "    if 0 <= number <= 100:\n",
    "\n",
    "        # 第三层\n",
    "        if number < 60:\n",
    "            print(\"不及格\")\n",
    "        else:\n",
    "            print(\"及格\")\n",
    "        # 第三层结束\n",
    "\n",
    "    else:\n",
    "        print(\"数值不在0~100之间\")\n",
    "    # 第二层结束\n",
    "\n",
    "else:\n",
    "    print(\"输入的不是一个数值\")\n",
    "# 第一层结束"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "start_time": "2024-07-03T10:27:06.379902Z",
     "end_time": "2024-07-03T10:27:10.158819Z"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [],
   "metadata": {
    "collapsed": false
   }
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
